home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / thinkref / archive / THINKPascalUH2.1.sea / THINKPas Univ Hdr 2.1 / Interfaces / OCE.p < prev    next >
Text File  |  1995-09-14  |  49KB  |  1,449 lines

  1. { Converted with MPW2TPas Tuesday, September 12, 1995 8:07:54 PM }
  2. {}
  3. {     File:        OCE.p}
  4. { }
  5. {     Contains:    Apple Open Collaboration Environment (AOCE) Interfaces.}
  6. { }
  7. {     Version:    Technology:    AOCE Toolbox 1.02}
  8. {                 Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18}
  9. { }
  10. {     Copyright:    © 1984-1995 by Apple Computer, Inc.}
  11. {                 All rights reserved.}
  12. { }
  13. {     Bugs?:        If you find a problem with this file, use the Apple Bug Reporter}
  14. {                 stack.  Include the file and version information (from above)}
  15. {                 in the problem description and send to:}
  16. {                     Internet:    apple.bugs@applelink.apple.com}
  17. {                     AppleLink:    APPLE.BUGS}
  18. { }
  19. {}
  20.  
  21. unit OCE;
  22. interface
  23.  
  24.  
  25. {$IFC UNDEFINED __OCE__}
  26. {$SETC __OCE__ := 1}
  27.  
  28.     uses
  29.         ConditionalMacros, Types, Files, Aliases, AppleTalk, Processes, PPCToolbox, Notification, EPPC, AppleEvents, Script;
  30.  
  31. { $PUSH}
  32. { $ALIGN MAC68K}
  33. { $LibExport+}
  34. { All utility routines defined here are callable at interrupt level. }
  35.  
  36.     type
  37.         OCERecordTypeIndex = INTEGER;
  38.  
  39.         OCEAttributeTypeIndex = INTEGER;
  40.  
  41. { For anyone who absolutely needs a define of the body of the standard record or}
  42. {attribute type, use these below.  CAUTION!  All the types below are assumed to be}
  43. {in character set 'smRoman'.  If you try to compare these to some RString or}
  44. {AttributeType variable, you must take the character set code into account.  Future}
  45. {standard types may be defined using character sets other than 'smRoman'. }
  46. { All these standard definitions begin with the Apple symbol (not shown here).}
  47. {}
  48. {NOTE:  To access these, you must call OCEGetIndRecordType or OCEGetIndAttributeType}
  49. {with the proper index.  These routines return pointers to the standard type.}
  50. {This was done so that code fragments (INITs, CDEVs, CSAMs, etc). which cannot}
  51. {use global data can also use these. }
  52. { Indices for the standard definitions for certain record types (OCERecordTypeIndex): }
  53.  
  54.     const
  55.         kUserRecTypeNum = 1;                            { "User" }
  56.         kGroupRecTypeNum = 2;                            { "Group" }
  57.         kMnMRecTypeNum = 3;                            { "AppleMail™ M&M" }
  58.         kMnMForwarderRecTypeNum = 4;                            { "AppleMail™ Fwdr" }
  59.         kNetworkSpecRecTypeNum = 5;                            { "NetworkSpec" }
  60.         kADAPServerRecTypeNum = 6;                            { "ADAP Server" }
  61.         kADAPDNodeRecTypeNum = 7;                            { "ADAP DNode" }
  62.         kADAPDNodeRepRecTypeNum = 8;                            { "ADAP DNode Rep" }
  63.         kServerSetupRecTypeNum = 9;                            { "Server Setup" }
  64.         kDirectoryRecTypeNum = 10;                            { "Directory" }
  65.         kDNodeRecTypeNum = 11;                            { "DNode" }
  66.         kSetupRecTypeNum = 12;                            { "Setup" }
  67.         kMSAMRecTypeNum = 13;                            { "MSAM" }
  68.         kDSAMRecTypeNum = 14;                            { "DSAM" }
  69.         kAttributeValueRecTypeNum = 15;                            { "Attribute Value" }
  70.         kBusinessCardRecTypeNum = 16;                            { "Business Card" }
  71.         kMailServiceRecTypeNum = 17;                            { "Mail Service" }
  72.         kCombinedRecTypeNum = 18;                            { "Combined" }
  73.         kOtherServiceRecTypeNum = 19;                            { "Other Service" }
  74.         kAFPServiceRecTypeNum = 20;                            { "Other Service afps" }
  75.         kFirstOCERecTypeNum = kUserRecTypeNum;                { first standard OCE record type }
  76.         kLastOCERecTypeNum = kAFPServiceRecTypeNum;        { last standard OCE record type }
  77.         kNumOCERecTypes = 20;
  78.  
  79. { Indices for the standard definitions for certain attribute types (OCEAttributeTypeIndex): }
  80.         kMemberAttrTypeNum = 1001;                            { "Member" }
  81.         kAdminsAttrTypeNum = 1002;                            { "Administrators" }
  82.         kMailSlotsAttrTypeNum = 1003;                            { "mailslots" }
  83.         kPrefMailAttrTypeNum = 1004;                            { "pref mailslot" }
  84.         kAddressAttrTypeNum = 1005;                            { "Address" }
  85.         kPictureAttrTypeNum = 1006;                            { "Picture" }
  86.         kAuthKeyAttrTypeNum = 1007;                            { "auth key" }
  87.         kTelephoneAttrTypeNum = 1008;                            { "Telephone" }
  88.         kNBPNameAttrTypeNum = 1009;                            { "NBP Name" }
  89.         kQMappingAttrTypeNum = 1010;                            { "ForwarderQMap" }
  90.         kDialupSlotAttrTypeNum = 1011;                            { "DialupSlotInfo" }
  91.         kHomeNetAttrTypeNum = 1012;                            { "Home Internet" }
  92.         kCoResAttrTypeNum = 1013;                            { "Co-resident M&M" }
  93.         kFwdrLocalAttrTypeNum = 1014;                            { "FwdrLocalRecord" }
  94.         kConnectAttrTypeNum = 1015;                            { "Connected To" }
  95.         kForeignAttrTypeNum = 1016;                            { "Foreign RLIs" }
  96.         kOwnersAttrTypeNum = 1017;                            { "Owners" }
  97.         kReadListAttrTypeNum = 1018;                            { "ReadList" }
  98.         kWriteListAttrTypeNum = 1019;                            { "WriteList" }
  99.         kDescriptorAttrTypeNum = 1020;                            { "Descriptor" }
  100.         kCertificateAttrTypeNum = 1021;                            { "Certificate" }
  101.         kMsgQsAttrTypeNum = 1022;                            { "MessageQs" }
  102.         kPrefMsgQAttrTypeNum = 1023;                            { "PrefMessageQ" }
  103.         kMasterPFAttrTypeNum = 1024;                            { "MasterPF" }
  104.         kMasterNetSpecAttrTypeNum = 1025;                            { "MasterNetSpec" }
  105.         kServersOfAttrTypeNum = 1026;                            { "Servers Of" }
  106.         kParentCIDAttrTypeNum = 1027;                            { "Parent CID" }
  107.         kNetworkSpecAttrTypeNum = 1028;                            { "NetworkSpec" }
  108.         kLocationAttrTypeNum = 1029;                            { "Location" }
  109.         kTimeSvrTypeAttrTypeNum = 1030;                            { "TimeServer Type" }
  110.         kUpdateTimerAttrTypeNum = 1031;                            { "Update Timer" }
  111.         kShadowsOfAttrTypeNum = 1032;                            { "Shadows Of" }
  112.         kShadowServerAttrTypeNum = 1033;                            { "Shadow Server" }
  113.         kTBSetupAttrTypeNum = 1034;                            { "TB Setup" }
  114.         kMailSetupAttrTypeNum = 1035;                            { "Mail Setup" }
  115.         kSlotIDAttrTypeNum = 1036;                            { "SlotID" }
  116.         kGatewayFileIDAttrTypeNum = 1037;                            { "Gateway FileID" }
  117.         kMailServiceAttrTypeNum = 1038;                            { "Mail Service" }
  118.         kStdSlotInfoAttrTypeNum = 1039;                            { "Std Slot Info" }
  119.         kAssoDirectoryAttrTypeNum = 1040;                            { "Asso. Directory" }
  120.         kDirectoryAttrTypeNum = 1041;                            { "Directory" }
  121.         kDirectoriesAttrTypeNum = 1042;                            { "Directories" }
  122.         kSFlagsAttrTypeNum = 1043;                            { "SFlags" }
  123.         kLocalNameAttrTypeNum = 1044;                            { "Local Name" }
  124.         kLocalKeyAttrTypeNum = 1045;                            { "Local Key" }
  125.         kDirUserRIDAttrTypeNum = 1046;                            { "Dir User RID" }
  126.         kDirUserKeyAttrTypeNum = 1047;                            { "Dir User Key" }
  127.         kDirNativeNameAttrTypeNum = 1048;                            { "Dir Native Name" }
  128.         kCommentAttrTypeNum = 1049;                            { "Comment" }
  129.         kRealNameAttrTypeNum = 1050;                            { "Real Name" }
  130.         kPrivateDataAttrTypeNum = 1051;                            { "Private Data" }
  131.         kDirTypeAttrTypeNum = 1052;                            { "Directory Type" }
  132.         kDSAMFileAliasAttrTypeNum = 1053;                            { "DSAM File Alias" }
  133.         kCanAddressToAttrTypeNum = 1054;                            { "Can Address To" }
  134.         kDiscriminatorAttrTypeNum = 1055;                            { "Discriminator" }
  135.         kAliasAttrTypeNum = 1056;                            { "Alias" }
  136.         kParentMSAMAttrTypeNum = 1057;                            { "Parent MSAM" }
  137.         kParentDSAMAttrTypeNum = 1058;                            { "Parent DSAM" }
  138.         kSlotAttrTypeNum = 1059;                            { "Slot" }
  139.         kAssoMailServiceAttrTypeNum = 1060;                            { "Asso. Mail Service" }
  140.         kFakeAttrTypeNum = 1061;                            { "Fake" }
  141.         kInheritSysAdminAttrTypeNum = 1062;                            { "Inherit SysAdministrators" }
  142.         kPreferredPDAttrTypeNum = 1063;                            { "Preferred PD" }
  143.         kLastLoginAttrTypeNum = 1064;                            { "Last Login" }
  144.         kMailerAOMStateAttrTypeNum = 1065;                            { "Mailer AOM State" }
  145.         kMailerSendOptionsAttrTypeNum = 1066;                        { "Mailer Send Options" }
  146.         kJoinedAttrTypeNum = 1067;                            { "Joined" }
  147.         kUnconfiguredAttrTypeNum = 1068;                            { "Unconfigured" }
  148.         kVersionAttrTypeNum = 1069;                            { "Version" }
  149.         kLocationNamesAttrTypeNum = 1070;                            { "Location Names" }
  150.         kActiveAttrTypeNum = 1071;                            { "Active" }
  151.         kDeleteRequestedAttrTypeNum = 1072;                            { "Delete Requested" }
  152.         kGatewayTypeAttrTypeNum = 1073;                            { "Gateway Type" }
  153.         kFirstOCEAttrTypeNum = kMemberAttrTypeNum;            { first standard OCE attr type }
  154.         kLastOCEAttrTypeNum = kGatewayTypeAttrTypeNum;        { last standard OCE attr type }
  155.         kNumOCEAttrTypes = 73;
  156.  
  157. { Miscellaneous enums: }
  158.         kRString32Size = 32;                            { max size of the body field in RString32 }
  159.         kRString64Size = 64;                            { max size of the body field in RString64 }
  160.         kNetworkSpecMaxBytes = 32;                            { max size of the body field in NetworkSpec }
  161.         kPathNameMaxBytes = 1024;                            { max size of the data field in PackedPathName }
  162.         kDirectoryNameMaxBytes = 32;                            { max size of the body field in DirectoryName }
  163.         kAttributeTypeMaxBytes = 32;                            { max size of the body field in AttributeType }
  164.         kAttrValueMaxBytes = 65536;                        { max size of any attribute value }
  165.         kRStringMaxBytes = 256;                            { max size (in bytes) of the body field of a recordName or recordType }
  166.         kRStringMaxChars = 128;                            { max size (in chars) of the body field of a recordName or recordType }
  167.  
  168.         kNULLDNodeNumber = 0;                            { Special value meaning none specified }
  169.         kRootDNodeNumber = 2;                            { DNodeNum corresponding to the root of the tree }
  170.  
  171. { This enum is used to select the kind of RString in calls such as OCERelRString,}
  172. {OCEEqualRString, and OCEValidRString.}
  173. {}
  174. {eGenericSensitive and eGenericInsensitive are enumerators that can be used if you}
  175. {use RStrings for things other than what you see in this file.  If you want them to}
  176. {be compared in a case- and diacritical-sensitive manner (c ≠ C ≠ ç), use}
  177. {eGenericSensitive.  If you want them to be compared in a case- and diacritical-}
  178. {insensitive manner (c = C = ç), use eGenericInensitive.}
  179. {WARNING:  do not use eGenericSensitive and eGenericInsensitive with catalog}
  180. {names, entity names, pathname parts, entity types, network specs, or attribute}
  181. {types!  Don't assume that you know how they should be compared!!! }
  182.         kOCEDirName = 0;
  183.         kOCERecordOrDNodeName = 1;
  184.         kOCERecordType = 2;
  185.         kOCENetworkSpec = 3;
  186.         kOCEAttrType = 4;
  187.         kOCEGenericSensitive = 5;
  188.         kOCEGenericInsensitive = 6;
  189.  
  190.  
  191.     type
  192.         RStringKind = INTEGER;
  193.  
  194. { Values for the signature field in Discriminator }
  195.  
  196.     const
  197.         kDirAllKinds = 0;
  198.         kDirADAPKind = 'adap';
  199.         kDirPersonalDirectoryKind = 'pdir';
  200.         kDirDSAMKind = 'dsam';
  201.  
  202.  
  203.     type
  204.         OCEDirectoryKind = LONGINT;
  205.  
  206. { Values returned by GetDSSpecInfo() }
  207.  
  208.     const
  209.         kOCEInvalidDSSpec = $3F3F3F3F;                    { could not be determined }
  210.         kOCEDirsRootDSSpec = 'root';                        { root of all catalogs ("Catalogs" icon) }
  211.         kOCEDirectoryDSSpec = 'dire';                        { catalog }
  212.         kOCEDNodeDSSpec = 'dnod';                        { d-node }
  213.         kOCERecordDSSpec = 'reco';                        { record }
  214.         kOCEentnDSSpec = 'entn';                        { extensionType is 'entn' }
  215.         kOCENOTentnDSSpec = 'not ';
  216.  
  217. { Values for AttributeTag }
  218.         typeRString = 'rstr';
  219.         typePackedDSSpec = 'dspc';
  220.         typeBinary = 'bnry';
  221.  
  222. { Bit flag corresponding to the canContainRecords bit.  Use it like this:}
  223. {    if (foo & kCanContainRecords)}
  224. {        then this dNode can contain records!}
  225. {kForeignNode is used to indicate nodes in the name hierarchy that correspond to}
  226. {foreign catalogs (meaning ADAP sees no clusters or DNodes beneath it, but}
  227. {mail routers might be able to route to clusters beneath it. }
  228.         kCanContainRecordsBit = 0;
  229.         kForeignNodeBit = 1;
  230.  
  231. { DirNodeKind }
  232.         kCanContainRecords = $1;
  233.         kForeignNode = $2;
  234.  
  235.  
  236.     type
  237.         DirNodeKind = LONGINT;
  238.  
  239. {*** Toolbox Control ***}
  240. { We will have a version number and attributes for toolboxes off the aa5e trap}
  241. {and the S&F server trap.}
  242. {}
  243. {This includes the OCE toolbox and S&F Server.  [Note: the S&F server will}
  244. {change to ONLY service ServerGateway calls —it will then be necessary to run}
  245. {it co–resident with an OCE toolbox].}
  246. {}
  247. {The high order word will represent the S&F Server version number.  The low}
  248. {order word will represent the OCE toolbox version number.  These will be zero}
  249. {until the component is up and running.  It is not possible to know these}
  250. {a–priori. Note: there will not be a seperate version numbers for each component}
  251. {in the OCE toolbox or S&F server.}
  252. {}
  253. {The above is consistent with the standard System 7.0 usage of Gestalt.}
  254. {}
  255. {The oce tb attribute gestaltOCETBPresent implies the existence of OCE on a}
  256. {machine.}
  257. {}
  258. {The OCE TB attribute gestaltOCETBAvailable implies the availablity of OCE calls.}
  259. {}
  260. {The attribute gestaltOCESFServerAvailable implies the availablity of OCE calls}
  261. {available through the S&F server. This are essentially the server gateway calls.}
  262. {}
  263. {Any (future) remaining OCE attributes may not be established correctly until}
  264. {the attribute gestaltOCETBAvailable is set.}
  265. {}
  266. {The gestalt selectors and values are listed below: }
  267.  
  268.     const
  269.         gestaltOCEToolboxVersion = 'ocet';                        { OCE Toolbox version }
  270.         gestaltOCEToolboxAttr = 'oceu';
  271.  
  272. { version includes:}
  273. { *  dirtb}
  274. { *  authtb}
  275. { *  mailtb}
  276. { *  ipmtb}
  277. { *  personal catalog}
  278. { *  ADSPSecure}
  279. { * e.g. all interfaces dependent on the aa5e trap. }
  280.         gestaltOCETB = $0102;                        { OCE Toolbox version 1.02 }
  281.         gestaltSFServer = $0100;                        { S&F Server version 1.0 }
  282.         gestaltOCETBPresent = $01;                            { OCE toolbox is present, not running }
  283.         gestaltOCETBAvailable = $02;                            { OCE toolbox is running and available }
  284.         gestaltOCESFServerAvailable = $04;                            { S&F Server is running and available }
  285.         gestaltOCETBNativeGlueAvailable = $10;                        { Native PowerPC Glue routines are availible }
  286.  
  287. {    Constants used for Transitions. }
  288.         ATTransIPMStart = 'ipms';
  289.         ATTransIPMShutdown = 'ipmd';
  290.         ATTransDirStart = 'dirs';
  291.         ATTransDirShutdown = 'dird';
  292.         ATTransAuthStart = 'auts';
  293.         ATTransAuthShutdown = 'autd';
  294.         ATTransSFStart = 's&fs';
  295.         ATTransSFShutdown = 's&fd';
  296.  
  297. { Some definitions for time-related parameters: }
  298. { Interpreted as UTC seconds since 1/1/1904 }
  299.  
  300.     type
  301.         UTCTime = LONGINT;
  302.  
  303. { seconds EAST of Greenwich }
  304.         UTCOffset = LONGINT;
  305.  
  306. { This is the same as the ScriptManager script. }
  307.         CharacterSet = INTEGER;
  308.  
  309. {*** RString ***}
  310. { struct RString is a maximum-sized structure.  Allocate one of these and it will}
  311. {hold any valid RString. }
  312.         RString = record
  313.                 charSet: CharacterSet;
  314.                 dataLength: INTEGER;
  315.                 body: array[0..255] of SInt8; { Byte }
  316.  { place for characters }
  317.             end;
  318.  
  319. { struct ProtoRString is a minimum-sized structure.  Use this for a variable-length RString. }
  320.         ProtoRString = record
  321.                 charSet: CharacterSet;
  322.                 dataLength: INTEGER;
  323.             end;
  324.  
  325.         RStringPtr = ^RString;
  326.         RStringHandle = ^RStringPtr;
  327.  
  328.         ProtoRStringPtr = ^ProtoRString;
  329.  
  330.         RString64 = record
  331.                 charSet: CharacterSet;
  332.                 dataLength: INTEGER;
  333.                 body: array[0..63] of SInt8; { Byte }
  334.             end;
  335.  
  336.         RString32 = record
  337.                 charSet: CharacterSet;
  338.                 dataLength: INTEGER;
  339.                 body: array[0..31] of SInt8; { Byte }
  340.             end;
  341.  
  342. { Standard definitions for the entity type field and attribute type}
  343. {have been moved to the end of the file. }
  344. { Copies str1 to str2.  str2Length is the size of str2, excluding header.}
  345. {A memFull error will be returned if that is not as large as str1->dataLength. }
  346.  
  347.     function OCECopyRString ({CONST}
  348.                                     var str1: RString; var str2: RString; str2Length: INTEGER): OSErr;
  349.     {$IFC NOT GENERATINGCFM}
  350.     inline
  351.         $303C, 776, $AA5C;
  352.     {$ENDC}
  353. {    Make an RString from a C string.  If the c string is bigger than rStrLength,}
  354. {only rStrLength bytes will be copied. (rStrLength does not include the header size) }
  355.     procedure OCECToRString (cStr: ConstCStringPtr; charSet: CharacterSet; var rStr: RString; rStrLength: INTEGER);
  356.     {$IFC NOT GENERATINGCFM}
  357.     inline
  358.         $303C, 825, $AA5C;
  359.     {$ENDC}
  360. {    Make an RString from a Pascal string.  If the Pascal string is bigger than rStrLength,}
  361. {only rStrLength bytes will be copied. (rStrLength does not include the header size) }
  362.     procedure OCEPToRString (pStr: ConstStr255Param; charSet: CharacterSet; var rStr: RString; rStrLength: INTEGER);
  363.     {$IFC NOT GENERATINGCFM}
  364.     inline
  365.         $303C, 826, $AA5C;
  366.     {$ENDC}
  367. {    Make a Pascal string from an RString.  It's up to you to check the char set of}
  368. {the RString, or if the length of the RString is greater than 255 (the Pascal string's}
  369. {length will simply be the lower byte of the RString's length).  The StringPtr that is}
  370. {returned will point directly into the RString (no memory will be allocated). }
  371.     function OCERToPString ({CONST}
  372.                                     var rStr: RString): StringPtr;
  373.     {$IFC NOT GENERATINGCFM}
  374.     inline
  375.         $303C, 827, $AA5C;
  376.     {$ENDC}
  377. {    Check the relative equality of two RStrings.  Determines if str1 is greater than,}
  378. {equal to, or less than str2.  Result types for OCERelRString are defined in <OSUtils.h>}
  379. {(same as for RelString). }
  380.     function OCERelRString (str1: univ Ptr; str2: univ Ptr; kind: RStringKind): INTEGER;
  381.     {$IFC NOT GENERATINGCFM}
  382.     inline
  383.         $303C, 813, $AA5C;
  384.     {$ENDC}
  385. {    Check for equality of two RStrings. Returns true if equal. }
  386.     function OCEEqualRString (str1: univ Ptr; str2: univ Ptr; kind: RStringKind): BOOLEAN;
  387.     {$IFC NOT GENERATINGCFM}
  388.     inline
  389.         $303C, 790, $AA5C;
  390.     {$ENDC}
  391. {    Check the validity of an RString.  Returns true if the RString is valid }
  392.     function OCEValidRString (str: univ Ptr; kind: RStringKind): BOOLEAN;
  393.     {$IFC NOT GENERATINGCFM}
  394.     inline
  395.         $303C, 824, $AA5C;
  396.     {$ENDC}
  397. {*** CreationID ***}
  398.  
  399.     type
  400.         CreationID = record
  401.                 source: LONGINT;                                { Fields definitions and usage are not defined }
  402.                 seq: LONGINT;
  403.             end;
  404.  
  405.         AttributeCreationID = CreationID;
  406.  
  407. { Returns a pointer to a null CreationID . }
  408.  
  409.     function OCENullCID: CreationID;
  410.     {$IFC NOT GENERATINGCFM}
  411.     inline
  412.         $303C, 836, $AA5C;
  413.     {$ENDC}
  414. { Returns a pointer to a special CreationID used within the PathFinder. }
  415.     function OCEPathFinderCID: CreationID;
  416.     {$IFC NOT GENERATINGCFM}
  417.     inline
  418.         $303C, 828, $AA5C;
  419.     {$ENDC}
  420. { Sets the CreationID to a null value. }
  421.     procedure OCESetCreationIDtoNull (var cid: CreationID);
  422.     {$IFC NOT GENERATINGCFM}
  423.     inline
  424.         $303C, 814, $AA5C;
  425.     {$ENDC}
  426. { Copies the value of cid1 to cid2. }
  427.     procedure OCECopyCreationID ({CONST}
  428.                                     var cid1: CreationID; var cid2: CreationID);
  429.     {$IFC NOT GENERATINGCFM}
  430.     inline
  431.         $303C, 768, $AA5C;
  432.     {$ENDC}
  433. { Check the equality of two CreationIDs. }
  434.     function OCEEqualCreationID ({CONST}
  435.                                     var cid1: CreationID; {CONST}
  436.                                     var cid2: CreationID): BOOLEAN;
  437.     {$IFC NOT GENERATINGCFM}
  438.     inline
  439.         $303C, 780, $AA5C;
  440.     {$ENDC}
  441. {*** NetworkSpec ***}
  442. { For the record, a NetworkSpec is an RString with a smaller maximum size.}
  443. {I don't just typedef it to an RString, because I want the definition of the NetworkSpec}
  444. {struct to contain the max length.  But it should be possible to typecast any}
  445. {NetworkSpec to an RString and use all the RString utilities on it. }
  446.  
  447.     type
  448.         NetworkSpec = record
  449.                 charSet: CharacterSet;
  450.                 dataLength: INTEGER;
  451.                 body: array[0..31] of SInt8; { Byte }
  452.  { always fixed at the max size }
  453.             end;
  454.  
  455.         NetworkSpecPtr = ^NetworkSpec;
  456.  
  457. {*** PackedPathName ***}
  458. { struct PackedPathName is a maximum-sized structure.  Allocate one of}
  459. {these and it will hold any valid packed pathname. }
  460.         PackedPathName = record
  461.                 dataLength: INTEGER;
  462.                 data: array[0..1021] of SInt8; { Byte }
  463.             end;
  464.  
  465. { struct ProtoPackedPathName is a minimum-sized structure.  Use this}
  466. {for a variable-length packed PathName. }
  467.         ProtoPackedPathName = record
  468.                 dataLength: INTEGER;
  469.             end;
  470.  
  471.         PackedPathNamePtr = ^PackedPathName;
  472.  
  473.         ProtoPackedPathNamePtr = ^ProtoPackedPathName;
  474.  
  475. {}
  476. {Copy the contents of path1 to path2.  path2Length is the size of path2, and must}
  477. {be large enough to hold a copy of path1.  A memFull error will be returned if that}
  478. {is not the case.}
  479. {}
  480.  
  481.     function OCECopyPackedPathName ({CONST}
  482.                                     var path1: PackedPathName; var path2: PackedPathName; path2Length: INTEGER): OSErr;
  483.     {$IFC NOT GENERATINGCFM}
  484.     inline
  485.         $303C, 772, $AA5C;
  486.     {$ENDC}
  487. {}
  488. {Returns true if packed path pointer is nil, or is of zero length, or is of}
  489. {length 2 and nParts of zero.}
  490. {}
  491.     function OCEIsNullPackedPathName ({CONST}
  492.                                     var path: PackedPathName): BOOLEAN;
  493.     {$IFC NOT GENERATINGCFM}
  494.     inline
  495.         $303C, 797, $AA5C;
  496.     {$ENDC}
  497. {}
  498. {OCEUnpackPathName breaks apart the path into its component RStrings, writing string}
  499. {pointers into the array 'parts', which the client asserts can hold as many as}
  500. {'nParts' elements. The number of parts actually found is returned.  Strings are}
  501. {placed in the array in order from lowest to highest.  The first pathName element}
  502. {beneath the root appears last.  NOTE THAT THE UNPACKED STRUCT CONTAINS POINTERS INTO}
  503. {THE PACKED STRUCT - DON'T DELETE OR REUSE THE PACKED STRUCT UNTIL YOU ARE FINISHED}
  504. {WITH THE UNPACKED STRUCT AS WELL}
  505. {}
  506.     function OCEUnpackPathName ({CONST}
  507.                                     var path: PackedPathName; var parts: RStringPtr; nParts: INTEGER): INTEGER;
  508.     {$IFC NOT GENERATINGCFM}
  509.     inline
  510.         $303C, 816, $AA5C;
  511.     {$ENDC}
  512.     function OCEPackedPathNameSize ({CONST}
  513.                                     var parts: RStringPtr; nParts: INTEGER): INTEGER;
  514.     {$IFC NOT GENERATINGCFM}
  515.     inline
  516.         $303C, 808, $AA5C;
  517.     {$ENDC}
  518. { OCEDNodeNameCount returns the number of RStrings contained within the path. }
  519.     function OCEDNodeNameCount ({CONST}
  520.                                     var path: PackedPathName): INTEGER;
  521.     {$IFC NOT GENERATINGCFM}
  522.     inline
  523.         $303C, 812, $AA5C;
  524.     {$ENDC}
  525. {}
  526. {OCEPackPathName packs the parts into the storage provided as 'path'.  path must be}
  527. {large enough to hold the packed pathname.  A memFull error will be returned if}
  528. {pathLength is too small.  parts[0] should contain the deepest pathName element,}
  529. {and parts[nParts - 1] should contain the name of the first pathName element beneath}
  530. {the root. }
  531. {}
  532.     function OCEPackPathName (var parts: RStringPtr; nParts: INTEGER; var path: PackedPathName; pathLength: INTEGER): OSErr;
  533.     {$IFC NOT GENERATINGCFM}
  534.     inline
  535.         $303C, 803, $AA5C;
  536.     {$ENDC}
  537. {}
  538. {Check the equality of two packed paths.}
  539. {}
  540.     function OCEEqualPackedPathName ({CONST}
  541.                                     var path1: PackedPathName; {CONST}
  542.                                     var path2: PackedPathName): BOOLEAN;
  543.     {$IFC NOT GENERATINGCFM}
  544.     inline
  545.         $303C, 785, $AA5C;
  546.     {$ENDC}
  547. {}
  548. {OCEValidPackedPathName checks that the packed PathName is internally consistent.}
  549. {Returns true if it's ok.}
  550. {}
  551.     function OCEValidPackedPathName ({CONST}
  552.                                     var path: PackedPathName): BOOLEAN;
  553.     {$IFC NOT GENERATINGCFM}
  554.     inline
  555.         $303C, 820, $AA5C;
  556.     {$ENDC}
  557. {*** DirDiscriminator ***}
  558.  
  559.     type
  560.         DirDiscriminator = record
  561.                 signature: OCEDirectoryKind;
  562.                 misc: LONGINT;
  563.             end;
  564.  
  565. { Copies the value of disc1 to disc2. }
  566.  
  567.     procedure OCECopyDirDiscriminator ({CONST}
  568.                                     var disc1: DirDiscriminator; var disc2: DirDiscriminator);
  569.     {$IFC NOT GENERATINGCFM}
  570.     inline
  571.         $303C, 769, $AA5C;
  572.     {$ENDC}
  573. { Check the equality of two DirDiscriminators. }
  574.     function OCEEqualDirDiscriminator ({CONST}
  575.                                     var disc1: DirDiscriminator; {CONST}
  576.                                     var disc2: DirDiscriminator): BOOLEAN;
  577.     {$IFC NOT GENERATINGCFM}
  578.     inline
  579.         $303C, 781, $AA5C;
  580.     {$ENDC}
  581. {}
  582. {This structure is called RLI because it really contains all the info you}
  583. {need to locate a record within the entire name space.  It contains four fields.}
  584. {The first two are the name of the catalog and a catalog discriminator.  These}
  585. {two fields are used to indicate to which catalog a given record belongs.  The}
  586. {discriminator is used to distinguish between two different catalogs that have}
  587. {the same name.}
  588. {}
  589. {The other two fields in the RLI structure are used to indicate a particular}
  590. {catalog node within the catalog specified by the directoryName and}
  591. {discriminator fields.  These fields are exactly analagous to the dirID and}
  592. {pathname used in HFS.  It is possible to specify a dNode just by dNodeNumber}
  593. {(pathname is nil), or just by pathname (dNodeNumber is set to kNULLDNodeNumber),}
  594. {or by a combination of the two.  The latter is called a 'partial pathname', and}
  595. {while it is valid in the Catalog Manager API, it is not supported by ADAP}
  596. {catalogs in Release 1.}
  597. {}
  598. {Note that the path parameter does not include the catalog name, but holds}
  599. {the names of all the nodes on the path to the desired catalog node, starting}
  600. {with the catalog node and working its way up the tree.}
  601. {}
  602. {*** RLI ***}
  603.  
  604.     type
  605.         DirectoryName = record
  606.                 charSet: CharacterSet;
  607.                 dataLength: INTEGER;
  608.                 body: array[0..31] of SInt8; { Byte }
  609.  { space for catalog name }
  610.             end;
  611.  
  612.         DirectoryNamePtr = ^DirectoryName;
  613.  
  614. { Catalog node number }
  615.         DNodeNum = LONGINT;
  616.  
  617.         RLI = record
  618.                 directoryName: DirectoryNamePtr;                        { pointer to the name of the catalog root }
  619.                 discriminator: DirDiscriminator;                        { used to discriminate between dup catalog names }
  620.                 dNodeNumber: DNodeNum;                                { number of the node }
  621.                 path: PackedPathNamePtr;                        { old-style RLI }
  622.             end;
  623.  
  624.         RLIPtr = ^RLI;
  625.  
  626. {}
  627. {Create a new RLI from the catalog name, discriminator, DNode number, and}
  628. {PackedPathName.  You must allocate the storage for the RLI and pass in a pointer}
  629. {to it.}
  630. {}
  631.  
  632.     procedure OCENewRLI (var newRLI: RLI; {CONST}
  633.                                     var dirName: DirectoryName; var discriminator: DirDiscriminator; dNodeNumber: DNodeNum; {CONST}
  634.                                     var path: PackedPathName);
  635.     {$IFC NOT GENERATINGCFM}
  636.     inline
  637.         $303C, 799, $AA5C;
  638.     {$ENDC}
  639. {}
  640. {Duplicate the contents of rli1 to rli2.  No errors are returned. This}
  641. {simply copies the pointers to the catalog name and path, wiping out any pointer}
  642. {that you might have had in there.}
  643. {}
  644.     procedure OCEDuplicateRLI ({CONST}
  645.                                     var rli1: RLI; var rli2: RLI);
  646.     {$IFC NOT GENERATINGCFM}
  647.     inline
  648.         $303C, 779, $AA5C;
  649.     {$ENDC}
  650. {}
  651. {Copy the contents of rli1 to rli2.  rli2 must already contain}
  652. {pointers to structures large enough to hold copies of the corresponding}
  653. {fields from rli1.  A memFull error will be returned if that is not the case.}
  654. {So if you allocate a brand new empty destination, you must at least set up}
  655. {its length fields.}
  656. {}
  657.     function OCECopyRLI ({CONST}
  658.                                     var rli1: RLI; var rli2: RLI): OSErr;
  659.     {$IFC NOT GENERATINGCFM}
  660.     inline
  661.         $303C, 775, $AA5C;
  662.     {$ENDC}
  663. {}
  664. {Check the equality of two RLIs.  This will take into account differences}
  665. {in the case and diacriticals of the directoryName and the PathName.}
  666. {NOTE THAT THIS WILL FAIL IF rli1 CONTAINS A DNODENUMBER AND A NIL PATHNAME,}
  667. {AND rli2 CONTAINS kNULLDNodeNumber AND A NON-NIL PATHNAME.  IN OTHER WORDS,}
  668. {THE TWO rlis MUST BE OF THE SAME FORM TO CHECK FOR EQUALITY.}
  669. {The one exception is that if the pathname is nil, a dNodeNumber of zero and}
  670. {kRootDNodeNumber will be treated as equal.}
  671. {}
  672.     function OCEEqualRLI ({CONST}
  673.                                     var rli1: RLI; {CONST}
  674.                                     var rli2: RLI): BOOLEAN;
  675.     {$IFC NOT GENERATINGCFM}
  676.     inline
  677.         $303C, 789, $AA5C;
  678.     {$ENDC}
  679. {}
  680. {Check the validity of an RLI.  This checks that the catalog name length}
  681. {is within bounds, and the packed pathname (if specified) is valid.}
  682. {}
  683.     function OCEValidRLI ({CONST}
  684.                                     var theRLI: RLI): BOOLEAN;
  685.     {$IFC NOT GENERATINGCFM}
  686.     inline
  687.         $303C, 823, $AA5C;
  688.     {$ENDC}
  689. {*** PackedRLI ***}
  690. {}
  691. {struct PackedRLI is a maximum-sized structure.  Allocate one of}
  692. {these and it will hold any valid packed pathname.}
  693. {}
  694.  
  695.     const
  696.         kRLIMaxBytes = 1296;
  697.  
  698.  
  699.     type
  700.         PackedRLI = record
  701.                 dataLength: INTEGER;
  702.                 data: array[0..1295] of SInt8; { Byte }
  703.             end;
  704.  
  705. {}
  706. {struct ProtoPackedRLI is a minimum-sized structure.  Use this}
  707. {for a variable-length packed RLI.}
  708. {}
  709.         ProtoPackedRLI = record
  710.                 dataLength: INTEGER;
  711.             end;
  712.  
  713.         PackedRLIPtr = ^PackedRLI;
  714.  
  715.         ProtoPackedRLIPtr = ^ProtoPackedRLI;
  716.  
  717. {}
  718. {Copy the contents of prli1 to prli2.  prli2Length is the size of prli2, and must}
  719. {be large enough to hold a copy of prli1.  A memFull error will be returned if that}
  720. {is not the case.}
  721. {}
  722.  
  723.     function OCECopyPackedRLI ({CONST}
  724.                                     var prli1: PackedRLI; var prli2: PackedRLI; prli2Length: INTEGER): OSErr;
  725.     {$IFC NOT GENERATINGCFM}
  726.     inline
  727.         $303C, 773, $AA5C;
  728.     {$ENDC}
  729. {}
  730. {OCEUnpackRLI breaks apart the prli into its components, writing pointers into}
  731. {the rli structure.  NOTE THAT THE UNPACKED STRUCT CONTAINS POINTERS INTO THE}
  732. {PACKED STRUCT - DON'T DELETE OR REUSE THE PACKED STRUCT UNTIL YOU ARE FINISHED}
  733. {WITH THE UNPACKED STRUCT AS WELL}
  734. {}
  735.     procedure OCEUnpackRLI ({CONST}
  736.                                     var prli: PackedRLI; var theRLI: RLI);
  737.     {$IFC NOT GENERATINGCFM}
  738.     inline
  739.         $303C, 817, $AA5C;
  740.     {$ENDC}
  741. {}
  742. {OCEPackedRLISize computes the number of bytes of memory needed to hold a}
  743. {PackedRLI manufactured from an RLI.  This length}
  744. {includes the length of the length field of PackedRLI, so it}
  745. {is safe to do a NewPtr (OCEPackedRLISize(...)).}
  746. {}
  747.     function OCEPackedRLISize ({CONST}
  748.                                     var theRLI: RLI): INTEGER;
  749.     {$IFC NOT GENERATINGCFM}
  750.     inline
  751.         $303C, 810, $AA5C;
  752.     {$ENDC}
  753. {}
  754. {OCEPackRLI packs the RLI into the storage provided as 'prli'.  prli must be}
  755. {large enough to hold the packed RLI.  A memFull error will be returned if}
  756. {prliLength is too small.}
  757. {}
  758.     function OCEPackRLI ({CONST}
  759.                                     var theRLI: RLI; var prli: PackedRLI; prliLength: INTEGER): OSErr;
  760.     {$IFC NOT GENERATINGCFM}
  761.     inline
  762.         $303C, 804, $AA5C;
  763.     {$ENDC}
  764. {}
  765. {OCEPackedRLIPartsSize computes the number of bytes of memory needed to hold a}
  766. {PackedRLI manufactured from the parts of an RLI.  This length}
  767. {includes the length of the length field of PackedRLI, so it}
  768. {is safe to do a NewPtr (OCEPackedRLIPartsSize(...)).}
  769. {}
  770.     function OCEPackedRLIPartsSize ({CONST}
  771.                                     var dirName: DirectoryName; var parts: RStringPtr; nParts: INTEGER): INTEGER;
  772.     {$IFC NOT GENERATINGCFM}
  773.     inline
  774.         $303C, 809, $AA5C;
  775.     {$ENDC}
  776. {}
  777. {OCEPackRLIParts packs the parts of an RLI into the storage provided as 'prli'.}
  778. {prli must be large enough to hold the packed RLI.  A memFull error will be returned}
  779. {if prliLength is too small.}
  780. {}
  781.     function OCEPackRLIParts ({CONST}
  782.                                     var dirName: DirectoryName; {CONST}
  783.                                     var discriminator: DirDiscriminator; dNodeNumber: DNodeNum; var parts: RStringPtr; nParts: INTEGER; var prli: PackedRLI; prliLength: INTEGER): OSErr;
  784.     {$IFC NOT GENERATINGCFM}
  785.     inline
  786.         $303C, 805, $AA5C;
  787.     {$ENDC}
  788. {}
  789. {Check the equality of two packed prlis.}
  790. {}
  791.     function OCEEqualPackedRLI ({CONST}
  792.                                     var prli1: PackedRLI; {CONST}
  793.                                     var prli2: PackedRLI): BOOLEAN;
  794.     {$IFC NOT GENERATINGCFM}
  795.     inline
  796.         $303C, 787, $AA5C;
  797.     {$ENDC}
  798. {}
  799. {Check the validity of a packed RLI.  This checks that the catalog name length}
  800. {is within bounds, and the packed pathname (if specified) is valid.}
  801. {}
  802.     function OCEValidPackedRLI ({CONST}
  803.                                     var prli: PackedRLI): BOOLEAN;
  804.     {$IFC NOT GENERATINGCFM}
  805.     inline
  806.         $303C, 822, $AA5C;
  807.     {$ENDC}
  808. {}
  809. {If this packed RLI describes a Personal Catalog, this call will return a pointer}
  810. {to an alias record that can be used to find the actual file.  Otherwise, it returns nil.}
  811. {}
  812.     function OCEExtractAlias ({CONST}
  813.                                     var prli: PackedRLI): AliasPtr;
  814.     {$IFC NOT GENERATINGCFM}
  815.     inline
  816.         $303C, 792, $AA5C;
  817.     {$ENDC}
  818. {}
  819. {This call returns a pointer to a packed RLI that represents the "Catalogs" icon, or}
  820. {the root of all catalogs.  It is used in the CollabPack.}
  821. {}
  822.     function OCEGetDirectoryRootPackedRLI: PackedRLI;
  823.     {$IFC NOT GENERATINGCFM}
  824.     inline
  825.         $303C, 838, $AA5C;
  826.     {$ENDC}
  827. {*** LocalRecordID ***}
  828.  
  829.     type
  830.         LocalRecordID = record
  831.                 cid: CreationID;
  832.                 recordName: RStringPtr;
  833.                 recordType: RStringPtr;
  834.             end;
  835.  
  836.         LocalRecordIDPtr = ^LocalRecordID;
  837.  
  838. { Create a LocalRecordID from a name, type, and CreationID }
  839.  
  840.     procedure OCENewLocalRecordID ({CONST}
  841.                                     var recordName: RString; {CONST}
  842.                                     var recordType: RString; {CONST}
  843.                                     var cid: CreationID; var lRID: LocalRecordID);
  844.     {$IFC NOT GENERATINGCFM}
  845.     inline
  846.         $303C, 798, $AA5C;
  847.     {$ENDC}
  848. {}
  849. {Copy LocalRecordID lRID1 to LocalRecordID lRID2.  lRID2 must already contain}
  850. {pointers to RString structures large enough to hold copies of the corresponding}
  851. {fields from lRID1.  A memFull error will be returned if that is not the case.}
  852. {So if you allocate a brand new empty destination, you must at least set up}
  853. {its length field.}
  854. {}
  855.     function OCECopyLocalRecordID ({CONST}
  856.                                     var lRID1: LocalRecordID; var lRID2: LocalRecordID): OSErr;
  857.     {$IFC NOT GENERATINGCFM}
  858.     inline
  859.         $303C, 770, $AA5C;
  860.     {$ENDC}
  861. {}
  862. {Check the equality of two local RIDs.}
  863. {}
  864.     function OCEEqualLocalRecordID ({CONST}
  865.                                     var lRID1: LocalRecordID; {CONST}
  866.                                     var lRID2: LocalRecordID): BOOLEAN;
  867.     {$IFC NOT GENERATINGCFM}
  868.     inline
  869.         $303C, 783, $AA5C;
  870.     {$ENDC}
  871. {*** ShortRecordID ***}
  872.  
  873.     type
  874.         ShortRecordID = record
  875.                 rli: PackedRLIPtr;
  876.                 cid: CreationID;
  877.             end;
  878.  
  879.         ShortRecordIDPtr = ^ShortRecordID;
  880.  
  881. { Create a ShortRecordID from an RLI struct and a CreationID }
  882.  
  883.     procedure OCENewShortRecordID ({CONST}
  884.                                     var theRLI: PackedRLI; {CONST}
  885.                                     var cid: CreationID; sRID: ShortRecordIDPtr);
  886.     {$IFC NOT GENERATINGCFM}
  887.     inline
  888.         $303C, 801, $AA5C;
  889.     {$ENDC}
  890. {}
  891. {Copy ShortRecordID sRID1 to ShortRecordID sRID2.  sRID2 must already contain}
  892. {pointers to structures large enough to hold copies of the corresponding}
  893. {fields from sRID1.  A memFull error will be returned if that is not the case.}
  894. {So if you allocate a brand new empty destination, you must at least set up}
  895. {its length fields.}
  896. {}
  897.     function OCECopyShortRecordID ({CONST}
  898.                                     var sRID1: ShortRecordID; var sRID2: ShortRecordID): OSErr;
  899.     {$IFC NOT GENERATINGCFM}
  900.     inline
  901.         $303C, 778, $AA5C;
  902.     {$ENDC}
  903. {}
  904. {Check the equality of two short RIDs.}
  905. {}
  906.     function OCEEqualShortRecordID ({CONST}
  907.                                     var sRID1: ShortRecordID; {CONST}
  908.                                     var sRID2: ShortRecordID): BOOLEAN;
  909.     {$IFC NOT GENERATINGCFM}
  910.     inline
  911.         $303C, 791, $AA5C;
  912.     {$ENDC}
  913. {*** RecordID ***}
  914.  
  915.     type
  916.         RecordID = record
  917.                 rli: PackedRLIPtr;                            { pointer to a packed rli structure }
  918.                 local: LocalRecordID;
  919.             end;
  920.  
  921.         RecordIDPtr = ^RecordID;
  922.  
  923. {    Create a RecordID from a packed RLI struct and a LocalRecordID.}
  924. {This doesn't allocate any new space; the RecordID points to the same}
  925. {packed RLI struct and the same name and type RStrings. }
  926.  
  927.     procedure OCENewRecordID ({CONST}
  928.                                     var theRLI: PackedRLI; {CONST}
  929.                                     var lRID: LocalRecordID; var rid: RecordID);
  930.     {$IFC NOT GENERATINGCFM}
  931.     inline
  932.         $303C, 800, $AA5C;
  933.     {$ENDC}
  934. {}
  935. {Copy RecordID RID1 to RecordID RID2.  RID2 must already contain}
  936. {pointers to structures large enough to hold copies of the corresponding}
  937. {fields from lRID1.  A memFull error will be returned if that is not the case.}
  938. {So if you allocate a brand new empty destination, you must at least set up}
  939. {its length fields.}
  940. {}
  941.     function OCECopyRecordID ({CONST}
  942.                                     var rid1: RecordID; {CONST}
  943.                                     var rid2: RecordID): OSErr;
  944.     {$IFC NOT GENERATINGCFM}
  945.     inline
  946.         $303C, 777, $AA5C;
  947.     {$ENDC}
  948. {    Check the equality of two RIDs. }
  949.     function OCEEqualRecordID ({CONST}
  950.                                     var rid1: RecordID; {CONST}
  951.                                     var rid2: RecordID): BOOLEAN;
  952.     {$IFC NOT GENERATINGCFM}
  953.     inline
  954.         $303C, 788, $AA5C;
  955.     {$ENDC}
  956. {*** PackedRecordID ***}
  957. {}
  958. {struct PackedRecordID is a maximum-sized structure.  Allocate one of}
  959. {these and it will hold any valid packed RecordID.}
  960. {}
  961.  
  962.     const
  963.         kPackedRecordIDMaxBytes = 1824;
  964.  
  965.  
  966.     type
  967.         PackedRecordID = record
  968.                 dataLength: INTEGER;
  969.                 data: array[0..1823] of SInt8; { Byte }
  970.             end;
  971.  
  972. {}
  973. {struct ProtoPackedRecordID is a minimum-sized structure.  Use this}
  974. {for a variable-length packed RecordID.}
  975. {}
  976.         ProtoPackedRecordID = record
  977.                 dataLength: INTEGER;
  978.             end;
  979.  
  980.         PackedRecordIDPtr = ^PackedRecordID;
  981.  
  982.         ProtoPackedRecordIDPtr = ^ProtoPackedRecordID;
  983.  
  984. {}
  985. {Copy PackedRecordID pRID1 to PackedRecordID pRID2.  pRID2 must already contain}
  986. {pointers to structures large enough to hold copies of the corresponding}
  987. {fields from pRID1.  A memFull error will be returned if that is not the case.}
  988. {pRID2Length is the number of bytes that can be put into pRID2, not counting the}
  989. {packed RecordID header.}
  990. {}
  991.  
  992.     function OCECopyPackedRecordID ({CONST}
  993.                                     var pRID1: PackedRecordID; {CONST}
  994.                                     var pRID2: PackedRecordID; pRID2Length: INTEGER): OSErr;
  995.     {$IFC NOT GENERATINGCFM}
  996.     inline
  997.         $303C, 774, $AA5C;
  998.     {$ENDC}
  999. {}
  1000. {Create a RecordID from a PackedRecordID.}
  1001. {NOTE THAT THE UNPACKED STRUCT CONTAINS POINTERS INTO THE PACKED STRUCT - DON'T DELETE}
  1002. {OR REUSE THE PACKED STRUCT UNTIL YOU ARE FINISHED WITH THE UNPACKED STRUCT AS WELL}
  1003. {}
  1004.     procedure OCEUnpackRecordID ({CONST}
  1005.                                     var pRID: PackedRecordID; var rid: RecordID);
  1006.     {$IFC NOT GENERATINGCFM}
  1007.     inline
  1008.         $303C, 818, $AA5C;
  1009.     {$ENDC}
  1010. {}
  1011. {Create a PackedRecordID from a RecordID.  pRID must be large enough to contain}
  1012. {the packed RecordID.  A memFull error will be returned if that is not the case.}
  1013. {packedRecordIDLength is the number of bytes that can be put into pRID, not}
  1014. {counting the header.}
  1015. {}
  1016.     function OCEPackRecordID ({CONST}
  1017.                                     var rid: RecordID; var pRID: PackedRecordID; packedRecordIDLength: INTEGER): OSErr;
  1018.     {$IFC NOT GENERATINGCFM}
  1019.     inline
  1020.         $303C, 806, $AA5C;
  1021.     {$ENDC}
  1022. {}
  1023. {Compute the number of bytes of memory needed to hold a RecordID when packed. This}
  1024. {length includes the length of the length field of PackedRecordID, so it}
  1025. {is safe to do a NewPtr (OCEPackedRecordIDSize(...)).}
  1026. {}
  1027.     function OCEPackedRecordIDSize ({CONST}
  1028.                                     var rid: RecordID): INTEGER;
  1029.     {$IFC NOT GENERATINGCFM}
  1030.     inline
  1031.         $303C, 811, $AA5C;
  1032.     {$ENDC}
  1033. {}
  1034. {Check the equality of two packed RIDs.}
  1035. {}
  1036.     function OCEEqualPackedRecordID ({CONST}
  1037.                                     var pRID1: PackedRecordID; {CONST}
  1038.                                     var pRID2: PackedRecordID): BOOLEAN;
  1039.     {$IFC NOT GENERATINGCFM}
  1040.     inline
  1041.         $303C, 786, $AA5C;
  1042.     {$ENDC}
  1043. { OCEValidPackedRecordID checks the validity of a packed record ID. }
  1044.     function OCEValidPackedRecordID ({CONST}
  1045.                                     var pRID: PackedRecordID): BOOLEAN;
  1046.     {$IFC NOT GENERATINGCFM}
  1047.     inline
  1048.         $303C, 821, $AA5C;
  1049.     {$ENDC}
  1050. {*** DSSpec ***}
  1051.  
  1052.     type
  1053.         DSSpec = record
  1054.                 entitySpecifier: ^RecordID;
  1055.                 extensionType: OSType;
  1056.                 extensionSize: INTEGER;
  1057.                 extensionValue: Ptr;
  1058.             end;
  1059.  
  1060.         DSSpecPtr = ^DSSpec;
  1061.  
  1062. {}
  1063. {struct PackedDSSpec is NOT a maximum-sized structure.  Allocate one of}
  1064. {these and it will hold any valid packed RecordID, but not necessarily any additional}
  1065. {data.}
  1066. {}
  1067.  
  1068.     const
  1069.         kPackedDSSpecMaxBytes = 1832;
  1070.  
  1071.  
  1072.     type
  1073.         PackedDSSpec = record
  1074.                 dataLength: INTEGER;
  1075.                 data: array[0..1831] of SInt8; { Byte }
  1076.             end;
  1077.  
  1078. {}
  1079. {struct ProtoPackedDSSpec is a minimum-sized structure.  Use this}
  1080. {for a variable-length packed DSSpec.}
  1081. {}
  1082.         ProtoPackedDSSpec = record
  1083.                 dataLength: INTEGER;
  1084.             end;
  1085.  
  1086.         PackedDSSpecPtr = ^PackedDSSpec;
  1087.  
  1088.         ProtoPackedDSSpecPtr = ^ProtoPackedDSSpec;
  1089.  
  1090. {}
  1091. {Copy PackedDSSpec pdss1 to PackedDSSpec pdss2.  pdss2 must already contain}
  1092. {pointers to structures large enough to hold copies of the corresponding}
  1093. {fields from pdss1.  A memFull error will be returned if that is not the case.}
  1094. {pdss2Length is the number of bytes that can be put into pdss2, not counting the}
  1095. {packed DSSpec header.}
  1096. {}
  1097.  
  1098.     function OCECopyPackedDSSpec ({CONST}
  1099.                                     var pdss1: PackedDSSpec; {CONST}
  1100.                                     var pdss2: PackedDSSpec; pdss2Length: INTEGER): OSErr;
  1101.     {$IFC NOT GENERATINGCFM}
  1102.     inline
  1103.         $303C, 771, $AA5C;
  1104.     {$ENDC}
  1105. {}
  1106. {Create a DSSpec from a PackedDSSpec.}
  1107. {NOTE THAT THE UNPACKED STRUCT CONTAINS POINTERS INTO THE PACKED STRUCT - DON'T DELETE}
  1108. {OR REUSE THE PACKED STRUCT UNTIL YOU ARE FINISHED WITH THE UNPACKED STRUCT AS WELL.}
  1109. {A pointer to the extension is returned in dss->extensionValue, and the length of that}
  1110. {extension is returned in dss->extensionSize.  If there is no extension, dss->extensionValue will}
  1111. {be set to nil.  This routine will unpack the RecordID (if any) into rid, unpack the rest}
  1112. {into dss, and set dss->entitySpecifier to rid.}
  1113. {}
  1114.     procedure OCEUnpackDSSpec ({CONST}
  1115.                                     var pdss: PackedDSSpec; var dss: DSSpec; var rid: RecordID);
  1116.     {$IFC NOT GENERATINGCFM}
  1117.     inline
  1118.         $303C, 815, $AA5C;
  1119.     {$ENDC}
  1120. {}
  1121. {Create a PackedDSSpec from a DSSpec.  pdss must be large enough to}
  1122. {contain the packed RecordID and any extension.  A memFull error will be returned if that}
  1123. {is not the case.  pdssLength is the number of bytes that can be put into pdss,}
  1124. {not counting the header.}
  1125. {}
  1126.     function OCEPackDSSpec ({CONST}
  1127.                                     var dss: DSSpec; var pdss: PackedDSSpec; pdssLength: INTEGER): OSErr;
  1128.     {$IFC NOT GENERATINGCFM}
  1129.     inline
  1130.         $303C, 802, $AA5C;
  1131.     {$ENDC}
  1132. {}
  1133. {Compute the number of bytes of memory needed to hold a DSSpec when packed. This}
  1134. {length includes the length of the length field of PackedDSSpec, so it}
  1135. {is safe to do a NewPtr (OCEPackedDSSpecSize(...)).}
  1136. {}
  1137.     function OCEPackedDSSpecSize ({CONST}
  1138.                                     var dss: DSSpec): INTEGER;
  1139.     {$IFC NOT GENERATINGCFM}
  1140.     inline
  1141.         $303C, 807, $AA5C;
  1142.     {$ENDC}
  1143. {    Check the equality of two DSSpecs.  This compares all fields, even the}
  1144. {extension (unless extensionSize == 0).  The extensions are compared in a case-insensitive and}
  1145. {diacrit-insensitive manner. }
  1146.     function OCEEqualDSSpec ({CONST}
  1147.                                     var pdss1: DSSpec; {CONST}
  1148.                                     var pdss2: DSSpec): BOOLEAN;
  1149.     {$IFC NOT GENERATINGCFM}
  1150.     inline
  1151.         $303C, 782, $AA5C;
  1152.     {$ENDC}
  1153. {    Check the equality of two PackedDSSpecs.  This compares all fields, even the}
  1154. {extension (unless extensionSize == 0).  The extensions are compared in a case-insensitive and}
  1155. {diacrit-insensitive manner. }
  1156.     function OCEEqualPackedDSSpec ({CONST}
  1157.                                     var pdss1: PackedDSSpec; {CONST}
  1158.                                     var pdss2: PackedDSSpec): BOOLEAN;
  1159.     {$IFC NOT GENERATINGCFM}
  1160.     inline
  1161.         $303C, 784, $AA5C;
  1162.     {$ENDC}
  1163. {}
  1164. {Check the validity of a PackedDSSpec.  If extensionType is}
  1165. {'entn', pdss must contain a valid entitySpecifier.  For all other extensionTypes, a nil}
  1166. {entitySpecifier is valid, but if non-nil, it will be checked for validity.  No check}
  1167. {is made on the extension.}
  1168. {}
  1169.     function OCEValidPackedDSSpec ({CONST}
  1170.                                     var pdss: PackedDSSpec): BOOLEAN;
  1171.     {$IFC NOT GENERATINGCFM}
  1172.     inline
  1173.         $303C, 819, $AA5C;
  1174.     {$ENDC}
  1175. {}
  1176. {Return info about a DSSpec.  This routine does not check validity.  If the}
  1177. {DSSpec has no extension, we determine whether it represents the root of all}
  1178. {catalogs, a single catalog, a DNode, or a Record.  Else it is invalid.}
  1179. {If the DSSpec has an extension, we simply return the extension type.}
  1180. {}
  1181.     function OCEGetDSSpecInfo ({CONST}
  1182.                                     var spec: DSSpec): OSType;
  1183.     {$IFC NOT GENERATINGCFM}
  1184.     inline
  1185.         $303C, 793, $AA5C;
  1186.     {$ENDC}
  1187. { OCEGetExtensionType returns the extensionType imbedded in the PackedDSSpec. }
  1188.     function OCEGetExtensionType ({CONST}
  1189.                                     var pdss: PackedDSSpec): OSType;
  1190.     {$IFC NOT GENERATINGCFM}
  1191.     inline
  1192.         $303C, 796, $AA5C;
  1193.     {$ENDC}
  1194. {}
  1195. {OCEStreamPackedDSSpec streams (flattens) a catalog object a little at a time by}
  1196. {calling the DSSpecStreamer routine that you provide.}
  1197. {}
  1198.     type
  1199.         DSSpecStreamerProcPtr = ProcPtr;  { FUNCTION DSSpecStreamer(buffer: UNIV Ptr; count: LONGINT; eof: BOOLEAN; userData: LONGINT): OSErr; }
  1200.         DSSpecStreamerUPP = UniversalProcPtr;
  1201.  
  1202.     const
  1203.         uppDSSpecStreamerProcInfo = $000037E0; { FUNCTION (4 byte param, 4 byte param, 1 byte param, 4 byte param): 2 byte result; }
  1204.  
  1205.     function NewDSSpecStreamerProc (userRoutine: DSSpecStreamerProcPtr): DSSpecStreamerUPP;
  1206.     {$IFC NOT GENERATINGCFM }
  1207.     inline
  1208.         $2E9F;
  1209.     {$ENDC}
  1210.  
  1211.     function CallDSSpecStreamerProc (buffer: univ Ptr; count: LONGINT; eof: BOOLEAN; userData: LONGINT; userRoutine: DSSpecStreamerUPP): OSErr;
  1212.     {$IFC NOT GENERATINGCFM}
  1213.     inline
  1214.         $205F, $4E90;
  1215.     {$ENDC}
  1216.  
  1217.     type
  1218.         DSSpecStreamer = DSSpecStreamerUPP;
  1219.  
  1220.  
  1221.     function OCEStreamPackedDSSpec ({CONST}
  1222.                                     var dss: DSSpec; stream: DSSpecStreamer; userData: LONGINT; var actualCount: LONGINT): OSErr;
  1223.     {$IFC NOT GENERATINGCFM}
  1224.     inline
  1225.         $303C, 829, $AA5C;
  1226.     {$ENDC}
  1227. {*** AttributeType ***}
  1228. {}
  1229. {For the record, an AttributeType is an RString with a smaller maximum size.}
  1230. {I don't just typedef it to an RString, because I want the definition of the AttributeType}
  1231. {struct to contain the max length, because I need to include it in the Attribute struct}
  1232. {below.  But it should be possible to typecast any AttributeType to an RString and use}
  1233. {all the RString utilities on it.}
  1234. {}
  1235.  
  1236.     type
  1237.         AttributeType = record
  1238.                 charSet: CharacterSet;
  1239.                 dataLength: INTEGER;
  1240.                 body: array[0..31] of SInt8; { Byte }
  1241.  { always fixed at the max size }
  1242.             end;
  1243.  
  1244.         AttributeTypePtr = ^AttributeType;
  1245.  
  1246. { Miscellaneous defines:  (these cannot be made into enums) }
  1247.  
  1248.     const
  1249.         kMinPackedRStringLength = 4;
  1250.  
  1251.         kMinPackedRLISize = 20;
  1252.  
  1253. {*** AttributeValue ***}
  1254. { same class as is used in AppleEvents }
  1255.  
  1256.     type
  1257.         AttributeTag = DescType;
  1258.  
  1259.         AttributeValue = record
  1260.                 tag: AttributeTag;
  1261.                 dataLength: LONGINT;
  1262.                 bytes: Ptr;
  1263.             end;
  1264.  
  1265.         AttributeValuePtr = ^AttributeValue;
  1266.  
  1267. {*** Attribute ***}
  1268.         Attribute = record
  1269.                 attributeType: AttributeType;
  1270.                 cid: AttributeCreationID;
  1271.                 value: AttributeValue;
  1272.             end;
  1273.  
  1274.         AttributePtr = ^Attribute;
  1275.  
  1276.  
  1277.     function OCEGetIndRecordType (stringIndex: OCERecordTypeIndex): RString;
  1278.     {$IFC NOT GENERATINGCFM}
  1279.     inline
  1280.         $303C, 795, $AA5C;
  1281.     {$ENDC}
  1282.     function OCEGetIndAttributeType (stringIndex: OCEAttributeTypeIndex): AttributeType;
  1283.     {$IFC NOT GENERATINGCFM}
  1284.     inline
  1285.         $303C, 794, $AA5C;
  1286.     {$ENDC}
  1287.  
  1288.     const
  1289.         _oceTBDispatch = $AA5E;
  1290.  
  1291. {***************************************************************************************}
  1292. {   PLEASE NOTE! ROUTINES HAVE MOVED TO THIS HEADER!}
  1293. { }
  1294. {   OCESizePackedRecipient, OCEPackRecipient, OCEUnpackRecipient, OCEStreamRecipient,}
  1295. {   OCEGetRecipientType, and OCESetRecipientType have moved to the OCE header file.}
  1296. {   The OCEMessaging header includes the OCE header, so no changes to your code are}
  1297. {   required.}
  1298. {}
  1299. {***************************************************************************************}
  1300.  
  1301.     type
  1302.         OCERecipient = DSSpec;
  1303.  
  1304.  
  1305.     const
  1306.         kOCESizePackedRecipient = 830;
  1307.         kOCEPackRecipient = 831;
  1308.         kOCEUnpackRecipient = 832;
  1309.         kOCEStreamRecipient = 833;
  1310.         kOCEGetRecipientType = 834;
  1311.         kOCESetRecipientType = 835;
  1312.  
  1313. {}
  1314. {Compute the space that a OCERecipient would take if it were in packed}
  1315. {form.  [Note: does NOT even pad extensionSize, so you may get an odd #back out]}
  1316. {Safe to pass dereferenced handle(s).}
  1317. {}
  1318.  
  1319.     function OCESizePackedRecipient ({CONST}
  1320.                                     var rcpt: OCERecipient): INTEGER;
  1321.     {$IFC NOT GENERATINGCFM}
  1322.     inline
  1323.         $303C, 830, $AA5C;
  1324.     {$ENDC}
  1325. {}
  1326. {Take an OCERecipient (scatter) and (gather) stream into the specified}
  1327. {buffer.  It is assumed that there is sufficient space in the buffer (that is}
  1328. {OCESizePackedRecipient).  Safe to pass dereferenced handle(s).}
  1329. {}
  1330.     function OCEPackRecipient ({CONST}
  1331.                                     var rcpt: OCERecipient; buffer: univ Ptr): INTEGER;
  1332.     {$IFC NOT GENERATINGCFM}
  1333.     inline
  1334.         $303C, 831, $AA5C;
  1335.     {$ENDC}
  1336. {}
  1337. {Take a packed OCERecipient and cast a the OCERecipient frame over it. Returns}
  1338. {amBadDestId if it doesn't look like an OCERecipient. Safe to pass dereferenced}
  1339. {handle(s).}
  1340. {}
  1341.     function OCEUnpackRecipient (buffer: univ Ptr; var rcpt: OCERecipient; var entitySpecifier: RecordID): OSErr;
  1342.     {$IFC NOT GENERATINGCFM}
  1343.     inline
  1344.         $303C, 832, $AA5C;
  1345.     {$ENDC}
  1346. {}
  1347. {Take an OCERecipient (scatter) and (gather) stream using the specified}
  1348. {function.  Safe to pass dereferenced handle(s).  If streamer function returns}
  1349. {OCEError OCEStreamRecipient stops execution and passes the error back to the caller}
  1350. {}
  1351.     type
  1352.         OCERecipientStreamerProcPtr = ProcPtr;  { FUNCTION OCERecipientStreamer(buffer: UNIV Ptr; count: LONGINT; eof: BOOLEAN; userData: LONGINT): OSErr; }
  1353.         OCERecipientStreamerUPP = UniversalProcPtr;
  1354.  
  1355.     const
  1356.         uppOCERecipientStreamerProcInfo = $000037E0; { FUNCTION (4 byte param, 4 byte param, 1 byte param, 4 byte param): 2 byte result; }
  1357.  
  1358.     function NewOCERecipientStreamerProc (userRoutine: OCERecipientStreamerProcPtr): OCERecipientStreamerUPP;
  1359.     {$IFC NOT GENERATINGCFM }
  1360.     inline
  1361.         $2E9F;
  1362.     {$ENDC}
  1363.  
  1364.     function CallOCERecipientStreamerProc (buffer: univ Ptr; count: LONGINT; eof: BOOLEAN; userData: LONGINT; userRoutine: OCERecipientStreamerUPP): OSErr;
  1365.     {$IFC NOT GENERATINGCFM}
  1366.     inline
  1367.         $205F, $4E90;
  1368.     {$ENDC}
  1369.  
  1370.     type
  1371.         OCERecipientStreamer = OCERecipientStreamerUPP;
  1372.  
  1373.  
  1374.     function OCEStreamRecipient ({CONST}
  1375.                                     var rcpt: OCERecipient; stream: OCERecipientStreamer; userData: LONGINT; var actualCount: LONGINT): OSErr;
  1376.     {$IFC NOT GENERATINGCFM}
  1377.     inline
  1378.         $303C, 833, $AA5C;
  1379.     {$ENDC}
  1380. { Get the OCERecipient's extensionType. Safe to pass dereferenced handle(s).}
  1381.     function OCEGetRecipientType ({CONST}
  1382.                                     var cid: CreationID): OSType;
  1383.     {$IFC NOT GENERATINGCFM}
  1384.     inline
  1385.         $303C, 834, $AA5C;
  1386.     {$ENDC}
  1387. {}
  1388. {Set the OCERecipient's extensionType in the specified cid.  (Note: we do NOT}
  1389. {check for a nil pointer).  If the extensionType is 'entn', the cid is assumed}
  1390. {to be "valid" and is not touched.  Note: to properly handle non 'entn''s this}
  1391. {routine must and will zero the high long (source) of the cid! Safe to pass}
  1392. {dereferenced handle(s).}
  1393. {}
  1394.     procedure OCESetRecipientType (extensionType: OSType; var cid: CreationID);
  1395.     {$IFC NOT GENERATINGCFM}
  1396.     inline
  1397.         $303C, 835, $AA5C;
  1398.     {$ENDC}
  1399. {***************************************************************************************}
  1400. {   PLEASE NOTE! ROUTINES HAVE MOVED TO THIS HEADER!}
  1401. { }
  1402. {   OCEGetAccessControlDSSpec and its corresponding data type and constants have}
  1403. {   moved to the OCE header from OCEAuthDir. The OCEAuthDir header includes the OCE}
  1404. {   header, so no changes to your code are required.}
  1405. {   }
  1406. {***************************************************************************************}
  1407. { access categories bit numbers }
  1408.  
  1409.     const
  1410.         kThisRecordOwnerBit = 0;
  1411.         kFriendsBit = 1;
  1412.         kAuthenticatedInDNodeBit = 2;
  1413.         kAuthenticatedInDirectoryBit = 3;
  1414.         kGuestBit = 4;
  1415.         kMeBit = 5;
  1416.  
  1417. { Values of CategoryMask }
  1418.         kThisRecordOwnerMask = $1;
  1419.         kFriendsMask = $2;
  1420.         kAuthenticatedInDNodeMask = $4;
  1421.         kAuthenticatedInDirectoryMask = $8;
  1422.         kGuestMask = $10;
  1423.         kMeMask = $20;
  1424.  
  1425.  
  1426.     type
  1427.         CategoryMask = LONGINT;
  1428.  
  1429. {}
  1430. {pass kThisRecordOwnerMask, kFriendsMask, kAuthenticatedInDNodeMask, kAuthenticatedInDirectoryMask,}
  1431. {kGuestMask, or kMeMask to this routine, and it will return a pointer to a}
  1432. {DSSpec that can be used in the Get or Set Access Controls calls.}
  1433. {}
  1434.  
  1435.     function OCEGetAccessControlDSSpec (categoryBitMask: CategoryMask): DSSpecPtr;
  1436.     {$IFC NOT GENERATINGCFM}
  1437.     inline
  1438.         $303C, 837, $AA5C;
  1439.     {$ENDC}
  1440.  
  1441. { $ALIGN RESET}
  1442. { $POP}
  1443.  
  1444. {$ENDC}
  1445.  {__OCE__}
  1446.  
  1447. implementation
  1448. end.
  1449.